export default class tabAction {
    constructor(comp) {
        this.comp = comp;
    }

     // 切换tab的时候
    tabChange = (value) => {
        const {props, action} = this.comp;
        const {search, emp, meta, dispatch, editTable} = props;
        
        dispatch({
            type: 'emp/update',
            payload: {
                tabKey: value,
                currentPage: value
            }
        });
        if(value==='entry'){
            let template = meta.getMeta();
            emp.infoSetData.map((item, index) => {
                template['appconfgrid' + index].items.forEach((item0, index0) => {
                    if(item0.attrcode==='old1' || item0.attrcode==='old2'){
                        item0.visible=false;
                    }
                    else if(item0.attrcode==='old'){
                        item0.visible=true;
                    }
                    editTable.hideColByKey('appconfgrid' + index, ['unentry_list_show', 'manager_list_show'])
                    editTable.showColByKey('appconfgrid' + index, ['entry_list_show'])
                });
            });
            
        dispatch({
            type: 'emp/update',
            payload: {           
                titleCheckboxDisp: 'inline-block'
            }
        });
        }
        else if(value==='noentry'){
            let template = meta.getMeta();
            emp.infoSetData.map((item, index) => {
                template['appconfgrid' + index].items.forEach((item0, index0) => {
                    if(item0.attrcode==='old' || item0.attrcode==='old2'){
                        item0.visible=false;
                    }
                    else if(item0.attrcode==='old1'){
                        item0.visible=true;
                    }
                    editTable.hideColByKey('appconfgrid' + index, ['entry_list_show', 'manager_list_show'])
                    editTable.showColByKey('appconfgrid' + index, ['unentry_list_show'])
                });
            });
            dispatch({
                type: 'emp/update',
                payload: {
                   
                    titleCheckboxDisp: 'none'
                }
            });
        }
        else if(value==='myteam'){
            let template = meta.getMeta();
            emp.infoSetData.map((item, index) => {
                template['appconfgrid' + index].items.forEach((item0, index0) => {
                    if(item0.attrcode==='old' || item0.attrcode==='old1'){
                        item0.visible=false;
                    }
                    else if(item0.attrcode==='old2'){
                        item0.visible=true;
                    }
                    editTable.hideColByKey('appconfgrid' + index, ['unentry_list_show', 'entry_list_show'])
                    editTable.showColByKey('appconfgrid' + index, ['manager_list_show'])
                });
                dispatch({
                    type: 'emp/update',
                    payload: {
                        titleCheckboxDisp: 'none'
                    }
                });
            });
        }
    }

}